<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

		<title>学生管理</title>




		<link rel="stylesheet" href="../../../css/bootstrap.css">
		<link rel="stylesheet" href="../../../css/main.css">

		<style>
			img {
				width: 200px;

			}

			.nav-sidebar a {
				color: black;
				font-size: 20px;
				font-weight: bold;

				/*background-color: gray;*/
			}
		</style>

	<body mpa-version="9.0.8" mpa-extension-id="ibefaeehajgcpooopoegkifhgecigeeg">
		<nav class="navbar navbar-inverse navbar-fixed-top">
			<div class="container-fluid">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
						aria-expanded="false" aria-controls="navbar">
						<span class="sr-only">学生管理系统</span> <span class="icon-bar"></span>
						<span class="icon-bar"></span> <span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="../main.html">学生管理系统</a>
				</div>
				<div id="navbar" class="navbar-collapse collapse">
					<!-- 导航条菜单 -->

					<ul class="nav navbar-nav navbar-right">
						<li><a href="../main.html">主页</a></li>
						<li><a href="../introduce.html">说明</a></li>
						<li><a href="../../../login.html">注销登录</a></li>
					</ul>

				</div>
			</div>
		</nav>

		<div class="container-fluid">
			<div class="row">
				<div class="col-sm-3 col-md-2 sidebar">

					<!-- 侧边栏 -->


					<ul class="nav nav-sidebar">


						<li class="	null"><a href="../main.html">首页</a>
						</li>
						<li class="	active"><a href="#">学生管理</a>
						</li>
						<li class="	null"><a href="./admin-score.html">成绩管理</a>
						</li>
						<li class="	null"><a href="./admin-course.html">课程管理</a>
						</li>
						<li class="	null"><a href="./admin-teacher.html">教师管理</a>
						</li>
						<li class="	null"><a href="./admin-user.html">账号管理</a></li>





					</ul>

				</div>
				<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
					<div class="row">

						<div class="col-sm-7">
							<form action="http://localhost:8080/StudentManage/admin/adminStudentUrl" method="get">
								<div class="input-group">
									<input type="text" name="query" class="form-control" placeholder="Search for...">
									<span class="input-group-btn">
										<button class="btn btn-primary" type="submit">搜索</button>
									</span>
								</div>
							</form>
						</div>

						<div class="col-sm-5">
							<button type="button" class="btn btn-primary" data-toggle="modal"
								data-target="#addStudent">添加学生
							</button>
						</div>
					</div>


					<div class="table-responsive">
						<table class="table table-striped">
							<thead>
								<tr>
									<th>#</th>
									<th>学号</th>
									<th>姓名</th>
									<th>性别</th>
									<th>年龄</th>
									<th>入学年份</th>
									<th>编辑</th>
								</tr>
							</thead>
							<tbody>

								<tr>
									<th>1</th>
									<th>0000</th>
									<th>Harry</th>
									<th>

										男



									</th>

									<th>20</th>
									<th>2020</th>
									<th>
										<button class="btn btn-default" data-student-no="0000" data-toggle="modal"
											data-target="#updateStudent">编辑
										</button>
										<button class="btn btn-danger" data-student-no="0000" data-toggle="modal"
											data-target="#deleteStudent">删除
										</button>
									</th>
								</tr>

								<tr>
									<th>2</th>
									<th>S001</th>
									<th>小明同学</th>
									<th>

										男



									</th>

									<th>18</th>
									<th>2020</th>
									<th>
										<button class="btn btn-default" data-student-no="S001" data-toggle="modal"
											data-target="#updateStudent">编辑
										</button>
										<button class="btn btn-danger" data-student-no="S001" data-toggle="modal"
											data-target="#deleteStudent">删除
										</button>
									</th>
								</tr>

								<tr>
									<th>3</th>
									<th>S002</th>
									<th>小红同学</th>
									<th>

										男



									</th>

									<th>20</th>
									<th>1997</th>
									<th>
										<button class="btn btn-default" data-student-no="S002" data-toggle="modal"
											data-target="#updateStudent">编辑
										</button>
										<button class="btn btn-danger" data-student-no="S002" data-toggle="modal"
											data-target="#deleteStudent">删除
										</button>
									</th>
								</tr>

								<tr>
									<th>4</th>
									<th>S003</th>
									<th>小李同学</th>
									<th>

										男



									</th>

									<th>20</th>
									<th>2019</th>
									<th>
										<button class="btn btn-default" data-student-no="S003" data-toggle="modal"
											data-target="#updateStudent">编辑
										</button>
										<button class="btn btn-danger" data-student-no="S003" data-toggle="modal"
											data-target="#deleteStudent">删除
										</button>
									</th>
								</tr>

								<tr>
									<th>5</th>
									<th>S004</th>
									<th>测试同学</th>
									<th>

										男



									</th>

									<th>18</th>
									<th>2020</th>
									<th>
										<button class="btn btn-default" data-student-no="S004" data-toggle="modal"
											data-target="#updateStudent">编辑
										</button>
										<button class="btn btn-danger" data-student-no="S004" data-toggle="modal"
											data-target="#deleteStudent">删除
										</button>
									</th>
								</tr>


							</tbody>
						</table>
					</div>

					<div>
						<nav aria-label="...">
							<ul class="pager hidden">
								<li class="previous"><a
										href="http://localhost:8080/StudentManage/admin/adminStudentUrl#"><span
											aria-hidden="true">←</span> 上一页</a></li>
								<li class="next"><a
										href="http://localhost:8080/StudentManage/admin/adminStudentUrl#">下一页 <span
											aria-hidden="true">→</span></a></li>
							</ul>
						</nav>
					</div>
				</div>
			</div>
		</div>

		<!-- add student -->
		<div class="modal fade" id="addStudent" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<form action="http://localhost:8080/StudentManage/admin/addStudent">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">×</span>
							</button>
							<h4 class="modal-title" id="myModalLabel">录入学生信息</h4>
						</div>
						<div class="modal-body">
							<div class="form-group">
								<label for="student-no" class="control-label">学号:</label> <input type="text"
									class="form-control" name="studentNo" id="student-no">
							</div>

							<div class="form-group">
								<label for="student-name" class="control-label">姓名:</label> <input type="text"
									class="form-control" name="studentName" id="student-name">
							</div>

							<div class="form-group">
								<label for="id-card" class="control-label">身份证号:</label> <input type="text"
									class="form-control" name="idCard" id="id-card">
							</div>


							<div class="form-group">
								<label for="gender" class="control-label">性别:</label> <select class="form-control"
									name="gender" id="gender">
									<option value="1">男</option>
									<option value="2">女</option>
								</select>
							</div>

							<div class="form-group">
								<label for="age" class="control-label">年龄:</label> <input type="text"
									class="form-control" name="age" id="age">
							</div>

							<div class="form-group">
								<label for="year" class="control-label">入学年份:</label> <input type="text"
									class="form-control" name="year" id="year">
							</div>


						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
							<button type="submit" class="btn btn-primary">提交</button>
						</div>
					</form>
				</div>
			</div>
		</div>

		<!-- update student -->
		<div class="modal fade" id="updateStudent" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<form action="http://localhost:8080/StudentManage/admin/updateStudent">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">×</span>
							</button>
							<h4 class="modal-title" id="udpate-myModalLabel">更新学生信息</h4>
						</div>
						<div class="modal-body">

							<div class="form-group">
								<label for="update-student-no" class="control-label">学号:</label> <input type="text"
									readonly="" class="form-control" name="studentNo" id="update-student-no">
							</div>

							<div class="form-group">
								<label for="update-student-name" class="control-label">姓名:</label> <input type="text"
									class="form-control" name="studentName" id="update-student-name">
							</div>

							<div class="form-group">
								<label for="update-id-card" class="control-label">身份证号:</label> <input type="text"
									class="form-control" name="idCard" id="update-id-card">
							</div>


							<div class="form-group">
								<label for="update-gender" class="control-label">性别:</label> <select
									class="form-control" name="gender" id="udpate-gender">
									<option value="1">男</option>
									<option value="2">女</option>
								</select>
							</div>

							<div class="form-group">
								<label for="update-age" class="control-label">年龄:</label> <input type="text"
									class="form-control" name="age" id="update-age">
							</div>

							<div class="form-group">
								<label for="update-year" class="control-label">入学年份:</label> <input type="text"
									class="form-control" name="year" id="update-year">
							</div>


						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
							<button type="submit" class="btn btn-primary">提交</button>
						</div>
					</form>
				</div>
			</div>
		</div>

		<!-- delete student -->
		<div class="modal fade" id="deleteStudent" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<form action="http://localhost:8080/StudentManage/admin/deleteStudent">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-label="Close">
								<span aria-hidden="true">×</span>
							</button>
							<h4 class="modal-title" id="udpate-myModalLabel">删除学生信息</h4>
						</div>
						<div class="modal-body">
							确认要删除该同学的所有信息吗（该操作不可逆）？
							<div class="form-group hidden">
								<label for="delete-student" class="control-label">学号:</label> <input type="text"
									class="form-control" name="studentNo" id="delete-student-no">
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
							<button type="button submit" class="btn btn-danger">删除</button>
						</div>
					</form>
				</div>
			</div>
		</div>


		<script src="../../../js/jquery-3.5.1.js"></script>
		<script src="../../../js/bootstrap.js"></script>

		<script>
			$('#updateStudent').on('show.bs.modal', function(event) {
				var button = $(event.relatedTarget)
				var studentNo = button.data('student-no')
				var modal = $(this)
				var params = {
					"studentNo": studentNo
				}
				$.ajax({
					url: '/StudentManage/getStudent',
					type: "get",
					data: params,
					success: function(result) {
						modal.find('#update-student-no').val(result.studentNo)
						modal.find('#update-student-name').val(result.studentName)
						modal.find('#update-id-card').val(result.idCard)
						modal.find('#update-gender').val(result.gender)
						modal.find('#update-age').val(result.age)
						modal.find('#update-year').val(result.year)
					}
				})
			})

			$('#deleteStudent').on('show.bs.modal', function(event) {
				var button = $(event.relatedTarget)
				var studentNo = button.data('student-no')
				var modal = $(this)
				modal.find('#delete-student-no').val(studentNo)
			})
		</script>

	</body>
</html>